use rust_i18n::t;
use std::path::PathBuf;

// 遍历指定目录下所有子目录
pub fn list_subdir(path: PathBuf) -> Vec<String> {
    use std::fs;
    if !path.exists() {
        println!("{}: {}", t!("path_not_exist"), path.display());
        return vec![];
    }
    let paths = fs::read_dir(path).expect("Read dir error");

    let mut result = vec![];
    for path in paths {
        let path = path.unwrap().path();
        if path.is_dir() {
            result.push(path.display().to_string());
        }
    }
    result
}
